<div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title"><?php echo $this->translate('选择商品序列表'); ?></h4>
    </div>
    <div class="modal-body box-body table-responsive no-padding">
        <table class="table table-hover">
            <thead>
            <tr>
                <td colspan="5">
                    <div class="col-xs-12 form-group">
                        <div class="col-sm-7">
                            <input type="text" name="searchGoodsSerialNumber" id="searchGoodsSerialNumber" class="form-control input-sm" placeholder="<?php echo $this->translate('输入商品序列号'); ?>" value="<?php echo $this->searchGoodsSerialNumber;?>">
                        </div>
                        <div>
                            <button type="button" class="btn btn-primary btn-sm" onclick="searchGoodsSerialNumber(<?php echo $this->goodsId; ?>);"><?php echo $this->translate('搜索'); ?></button>
                        </div>
                    </div>

                </td>
            </tr>
            <tr>
                <th style="width: 2%"><input type="checkbox" class="minimal select-serial-checkbox"></th>
                <th style="width: 30%"><?php echo $this->translate('商品序列号'); ?></th>
                <th style="width: 40%"><?php echo $this->translate('商品名称'); ?></th>
                <th style="width: 28%"><?php echo $this->translate('所在仓库'); ?></th>
            </tr>
            </thead>
            <tbody>
            <?php if($this->goodsSerialNumberList) foreach ($this->goodsSerialNumberList as $serialNumber) { ?>
                <tr>
                    <td><input  name="select_id[]" value="<?php echo $serialNumber[0]->getNumberId(); ?>" type="checkbox" class="minimal"></td>
                    <td><?php echo $this->escapeHtml($serialNumber[0]->getSerialNumber()); ?></td>
                    <td><?php echo $this->escapeHtml($serialNumber['goodsName']); ?></td>
                    <td><?php echo $this->escapeHtml($serialNumber['warehouseName']); ?></td>
                </tr>
            <?php } ?>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="2"><input type="checkbox" class="minimal select-all-checkbox"> <?php echo $this->translate('全选'); ?></td>
                <td colspan="3">
                    <?php echo $this->paginationControl($this->goodsSerialNumberList,
                        'Sliding',
                        'layout/ajaxPage',
                        ['route' => 'goods-serial-number', 'action' => 'ajaxGoodsSerialNumberSearch', 'showDivId' => 'addSerialNumberBody']); ?>
                </td>
            </tr>
            </tfoot>

        </table>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-primary btn-sm" onclick="addMoreSelectGoodsSerialNumber();"><?php echo $this->translate('选择完毕'); ?></button>
        <button type="button" class="btn btn-default btn-sm" data-dismiss="modal"><?php echo $this->translate('关闭'); ?></button>
    </div>
</div>
<script src="<?php echo $this->basePath('js/common.js'); ?>?t=<?php echo time(); ?>" ></script>
<script>
    $(".select-serial-checkbox").click(function () {
        var checkState = this.checked;
        if(!checkState) {
            $("input[name='select_id[]']").prop("checked", false);
            $(".select-serial-checkbox").prop("checked", false);
        } else {
            $("input[name='select_id[]']").prop("checked", true);
        }
    });
    function goodsSerialNumberIdStr() {

    }
</script>